package com.leetcode.LC;

public class LC344 {
    public void reverseString(char[] s) {

        int a = 0, b = s.length - 1, sum;
        while (a <= b) {
            sum = s[a] + s[b];
            s[a] = (char) (sum - s[a]);
            s[b] = (char) (sum - s[b]);
            a++;
            b--;
        }
        System.out.println(s);

    }

    public void reverseString2(char[] s) {

        int a = 0, b = s.length - 1;
        char sum;
        while (a <= b) {
            sum = s[a];
            s[a] = s[b];
            s[b] = sum;
            a++;
            b--;
        }
        System.out.println(s);

    }

    public static void main(String[] args) {
        new LC344().reverseString(new char[]{'h', 'e', 'l', 'l', 'o'});


    }
}
